//http://www.ecshop.net/interface/wx/
/**
 * 保存工程的基本路径以及通用方法（方便后期工程的转移）
 */

$(function() {
    window['cl'] = {};
    //判断是否登陆
    cl.isLoginUrl = baseUrl+"Login.php?act=isLogin";
    //微信登陆地址
    cl.wxLoginUrl = baseUrl+"Login.php?act=logonA";
  //微信jssdk信息构建
    cl.wxJssdkUrl = baseUrl+"Picture.php?act=getJssdk";
    //获取登录者信息
    cl.getLoginInfoUrl = baseUrl+"Login.php?act=loginInfo";
    //获取登录者信息+随拍数据
    cl.getLoginInfoUrl2 = baseUrl+"Login.php?act=getLoginInfo";
    //保存登录者信息
    cl.saveInfoUrl = baseUrl+"Login.php?act=saveInfo";
    //商品首页
    cl.initMarketUrl = baseUrl+"Market.php?act=initMarket";
    //产品列表
    cl.getGoodsListUrl = baseUrl+"Goods.php?act=getGoodsListByCatId";
    //产品详情
    cl.getGoodsInfoUrl = baseUrl+"Goods.php?act=getGoodsInfo";
    //文章列表
    cl.getArticleListUrl = baseUrl+"Article.php?act=getArticleByCatId";
    //文章详情
    cl.getArticleInfoUrl = baseUrl+"Article.php?act=getArticleInfo";
    //商家列表
    cl.getMapListUrl = baseUrl+"Map.php?act=getMapList";
    //商家列表
    cl.getMapListPageUrl = baseUrl+"Map.php?act=getMapListPage";
    //wxjssdk的资料
    cl.getWxInfoUrl = baseUrl+"Map.php?act=getWxInfo";
    //首页信息图片背景图
    cl.getMainInfoUrl = baseUrl+"Main.php?act=getMainInfo";
    //用户资料跳转页面
    cl.goUserInfoUrl = ip+"/info.php?act=info&type=edit";
    //社区首页
    cl.getTrendsUrl = baseUrl+"News.php?act=initTrends";
    //我的收藏
    cl.getMyCollectUrl = baseUrl+"News.php?act=getMyCollect";
    //收藏事件
    cl.collectNewUrl = baseUrl+"News.php?act=collectNew";
    //帖子详情
    cl.getNewsInfoUrl = baseUrl+"News.php?act=getNewsInfo";
    //点赞
    cl.likeNewUrl = baseUrl+"News.php?act=likeNew";
    //评论
    cl.replyUrl = baseUrl+"News.php?act=reply";
    //删除评论
    cl.delCommentUrl = baseUrl+"News.php?act=delComment";
    //首页加载路径
    cl.getCommunityUrl = baseUrl+"News.php?act=getCommunity";
    //首页上下拉
    cl.refreshCommunityUrl = baseUrl+"News.php?act=refreshCommunity";
    //首页上下拉
    cl.delNewsUrl = baseUrl+"News.php?act=delNews";
    //获取sessionUrl
    cl.getSessionWxIdUrl = baseUrl+"Picture.php?act=getSessionWxid";
    //首页加载路径
    cl.getCommunityNewUrl = baseUrl+"News.php?act=getCommunityNew";
    //首页上下拉
    cl.refreshCommunityNewUrl = baseUrl+"News.php?act=refreshCommunityNew";
    //社区
    cl.getTrendsNewUrl = baseUrl+"News.php?act=initTrendsNew";
    //社区刷新
    cl.refreshTrendsNewUrl = baseUrl+"News.php?act=refreshTrendsNew";
    
    cl.commentNotify = baseUrl+"Login.php?act=commentNotify";
    
    cl.user = {
    		"id":0,//wxid
    		"uid":0,//ecshop_id
    		"user_name":"马上登录",
    		"user_info":"马上注册",
    		"headimgurl":"images/head.png",
    		"user_money":0,
    		"pay_points":0,
    		"mobile_phone":"",
    		"latitude":0,
    		"longitude":0,
    		"notify":0,
    		"notify_comment":0,
    		initUser:function(json){
    			
    			console.log(json.notify);
    			if(json){
//    				if(json.uName!=""){
//    					this.user_name = json.uName;
//    				}else if(json.wName!=""){
    				this.id = json.id != undefined ? json.id : 0;
    				this.uid = json.uid != undefined ? json.uid : 0;
    				this.user_name = json.wName!=undefined?json.wName:"";
//    				}
    				this.user_info = json.mobile_phone!=""?"我的资料":"马上注册";
//    				this.user_name = json.user_name != undefined ? json.user_name : null;
    				this.headimgurl = json.headimgurl != undefined ? json.headimgurl : null;
    				this.notify = json.notify != undefined ? json.notify : 0;
    				this.notify_comment = json.notify != undefined ? json.notify : 0;
    				//alert(json.mobile_phone);
    				this.mobile_phone = json.mobile_phone != undefined ? json.mobile_phone : "";
    				this.user_money = json.user_money != 0 ? json.user_money : 0;
    				this.pay_points = json.pay_points != 0 ? json.pay_points : 0;
    				
    			}
    		}
	    	
    }
})
